# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html

import os


class ZhongyaowangPipeline(object):
    def process_item(self, item, spider):
        print('==========================================')
        print(item)
        os.makedirs(item['fenlei'], exist_ok=True)
        with open(item['fenlei'] + '/' + item['biaoti'] + '.txt', 'a+', encoding='utf8') as f:
            f.write(item['neirong'])
        return item
